<%@ page import="cn.lily.com.configure.util.ESBSetting"%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="cn.lily.inst.web.frames.FrameConfig" %>
<%@ page import="cn.lily.inst.web.security.SystemManager" %>
<%@ page import="cn.lily.web.util.context.WebContext" %>
<%@ page import="cn.lily.esb.context.AuthEntity" %>
<%@ page import="cn.lily.com.lang.BusinessDate" %>

<%
    String rand = (String)session.getAttribute("rand");
	request.getSession().invalidate();
	Cookie[] cookies=request.getCookies();
	if(null!=cookies){
	    for(int i=0;i<cookies.length;i++){
	        if("JSESSIONID".equalsIgnoreCase(cookies[i].getName())){
	            cookies[i].setMaxAge(0);
	            response.addCookie(cookies[i]);
	        }
	    }
	}
	session = request.getSession(true);
	session.setAttribute("rand", rand);
	
    response.addHeader("Cache-Control", "no-store");
	response.addHeader("Pragma", "no-cache");
	String referer=request.getHeader("Referer");
	
	if((referer!=null) &&(referer.trim().endsWith(ESBSetting.getString("appCode")+"/"))|| (referer!=null) &&(referer.trim().endsWith("index2.jsp")) || (referer!=null) &&(referer.trim().endsWith("homePage.jsp"))){
	}else{
		response.sendRedirect("/"+ESBSetting.getString("appCode")+"/index2.jsp");
		return;
	}
%>
<%@ include file="../security/loginassistor.jsp"%>
<%
	String hintStr = "";
	String topMenuStr = "";
	String skinName = "";
	String operid = "";
	String welcomepage = "";
    String operInfo="";

	String exitUrl = "";
	
	AuthEntity authEntity = (AuthEntity) request.getSession().getAttribute(WebContext.LOG_AUTH_CONTEXT);
	if (authEntity != null) {
		hintStr = authEntity.getOperatorName();
		skinName = authEntity.getSkinName();
		operid = authEntity.getOperatorId();
		welcomepage = authEntity.getWelcomePage();
		exitUrl = authEntity.getExitUrl();
        if("9999".equals(authEntity.getOperatorId())){
          operInfo=authEntity.getOperatorName();
        }else{
          operInfo=authEntity.getOperEntity().getCommEntity().getCommName()+"&nbsp;/&nbsp;"+authEntity.getOperatorName();
        }
	}else{
		request.getRequestDispatcher("index2.jsp").forward(request,response);
	}
 %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<%@ include file="/global.jsp"%>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta charset="UTF-8">
<title><%=FrameConfig.getAppName()%></title>
<link rel="shortcut icon" href="<%=contextPath%>/images/logo.ico" type="/image/x-icon" />
<link href="/<%=ESBSetting.getString("appCode")%>/public/style/skin_bootstrap/bootstrap-3.3.0/bootstrap.css" rel="stylesheet" media="screen">
<link href="/<%=ESBSetting.getString("appCode")%>/public/font/awesome/font-awesome-4.7.0.css" rel="stylesheet">
<link href="<%=FrameConfig.getCSSPath("index.css")%>" rel="stylesheet" />
</head>
<body>
	<div id="header">
	    <div class="header-bg-right"></div>
		<div class="header-logo">
			<img src="<%=FrameConfig.getFramePath("logo.png")%>" alt="" />
		</div>
	    <div id="header-login-info">
			<ul>
				<li>欢迎【<%=operInfo %>】登录系统!&nbsp;&nbsp;</li>
				<li>今天：<%=BusinessDate.getToday() %>&nbsp;<%=BusinessDate.getWeekDay() %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
				<li class="link" onclick="changeinfo()">设置</li>
				<li class="line">|</li>
				<li class="link">帮助</li>
				<li class="line">|</li>
				<li class="link" onclick="exit()">退出</li>
			</ul>
	    </div>
	</div>

    <div id="content">
	    <div id="header-menu">
	    	<ul id="tab-menu" class="nav nav-tabs">
	       		<li id="tab-index" class="active" style="margin-left:100px;"><a style="color:#D9261C;font-size:18px;" onclick="hideHead()" href="#condent-index" data-toggle="tab">应用中心</a></li>
	        	
	        </ul>
	        <div id="drag" state="up"></div>
	 	</div>

		<div id="body-tab" class="tab-content">
			<div class="tab-pane active" id="condent-index">
				<iframe src="center.jsp" width="100%" frameborder="0" scrolling="no" height="100%"></iframe>
			</div>
		</div>
	</div>

	<script src="<%=FrameConfig.getBaseJsUrl()%>common/jquery-1.9.1.min.js"></script>
	<script src="/<%=ESBSetting.getString("appCode")%>/public/js/skin_bootstrap/bootstrap-3.3.0/bootstrap-3.3.0.js"></script>
	<script src="<%=FrameConfig.getJsUrl("index.js")%>"></script>
	<script type="text/javascript">
	  	var pwdUpdate="<%=authEntity.getOperEntity().getPwdUpdate()%>";
	  	if(pwdUpdate=="0"){
	  		changeinfo();
	  	}
	  	function exit(){
	  		$.ajax({  
			    url:contextPath+"/frames/common/sessionExit.jsp",  
			    type:"post",  
			    success:function(){ 
			    	window.location.replace("<%=exitUrl%>");
			    }
			});  		
		}
	  	function changeinfo(){
	  		var dialogArg = "dialogwidth:350px; Dialogheight:200px;center:yes;help:no;resizable:no;scroll:no;status:no";
			var arg = new Object();
	 		arg.top =  window.top;
			var  dd    = window.showModalDialog(contextPath +"/UI/portal/system/user/changeinfo.jsp",arg, dialogArg);
		}

		//初始化页面高度信息
		$(function() {
			var hei=$(window).height();
			$("#content").css({hei:hei-51});
			
			$("#drag").click(function(){
				if($("#header").css("top")=="0px"){
					$(this).css({"background-image":"url(../../../public/images/skin_portal/frames/negative/drag-down.png)"});
					$(this).attr("state","down");
					$("#header").css({top:-50});
					$("#content").css({top:0});
					$("#content").css({height:hei});	
				}else{
					$(this).css({"background-image":"url(../../../public/images/skin_portal/frames/negative/drag-up.png)"});
					$(this).attr("state","up");
					$("#header").css({top:0});
					$("#content").css({top:51});
					$("#content").css({height:hei-51});
				}
			});
	
					
			//下拉菜单自动回收
			$("body").bind("click", function(){
	            $("iframe").contents().find("#app-dropdown-menu").hide();
	        });
			
			$(window).unload(function(){ 
				$.ajax({  
				    url:contextPath+"/frames/common/sessionExit.jsp",  
				    type:"post",  
				    success:function(){ 
				    }
				});  
			}); 
			
			window.onbeforeunload = function(){
				$.ajax({  
				    url:contextPath+"/frames/common/sessionExit.jsp",  
				    type:"post",  
				    success:function(){ 
				    }
				});  	
			};
			
		});	

	</script>
</body>
</html>

